<!--
 * @Author: AHANG
 * @Date: 2022-07-09 14:44:46
 * @LastEditors: AHANG
 * @LastEditTime: 2022-07-09 15:34:40
 * @Description: 
-->
<template>
  <div class="login">
    <el-dialog
      title="Vue-System"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :show-close="false"
      :visible.sync="dialogFormVisible"
    >
      <el-input
        v-model="obj.user"
        placeholder="账号"
        size="normal"
        clearable
      ></el-input>
      <el-input
        v-model="obj.pass"
        placeholder="密码"
        size="normal"
        show-password
      ></el-input>
      <div class="footer">
        <el-button type="primary" size="default" @click="logins"
          >登录</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { login } from "@/api";
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Login",
  data() {
    return {
      obj: {
        user: "",
        pass: "",
      },

      dialogFormVisible: true,
    };
  },
  methods: {
    logins() {
      console.log(this.obj);
      login(this.obj).then((res) => {
        console.log(res);
        if (!res.data.NO) {
          this.isMessage(res.data.msg, "error");
        }
        if (res.data.NO) {
          this.isMessage(res.data.msg, "success");
          this.$router.push({ path: "/Home/Info" });
        }
      });
    },
  },
};
</script>

<style scoped>
.login >>> .el-dialog {
  width: 30% !important;
  border-radius: 20px !important;
}
.el-dialog__title {
  font-weight: bold;
}
.el-input {
  margin: 0.625rem 0;
}
.el-dialog__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: column;
}
.footer {
  display: flex;
  flex-direction: row-reverse;
}
</style>